package logic

import (
	"context"
	"weixin/moble/mysql"

	"weixin/weixinrpc/internal/svc"
	"weixin/weixinrpc/weixinrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type PerfecLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewPerfecLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PerfecLogic {
	return &PerfecLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *PerfecLogic) Perfec(in *weixinrpc.PerfectRequest) (*weixinrpc.PerfectResponse, error) {
	// todo: add your logic here and delete this line
	var user mysql.Information
	mysql.DB.Debug().Find(&user)
	user.ID = uint(in.Id)
	user.Profile = in.Profile
	user.Name = in.Name
	user.Account = in.Account
	mysql.DB.Debug().Updates(&user)
	return &weixinrpc.PerfectResponse{
		Id: int64(user.ID),
	}, nil
}
